Cloneable
is a marker interface that defines the contract of the Object.clone
method, which is to create a
consistent copy of the instance. The clone
method is not defined by the interface though, but by class Objects
.
The general problem with marker interfaces is that their definitions cannot be enforced by the compiler because they have no own API. When a class
implements Cloneable
but does not override Object.clone
, it is highly likely that it violates the contract for
Cloneable
.